/*
 * Filename: LogManager.java
 * Copyright: AICOMSOFT Copyright (C) 2012/1/1 To 2022/1/2
 * Description:
 * Author: Samir Tan
 *
 * Modified by:
 * Modified time: 2012-9-11
 * Trace ID:
 * CR NO.:
 * Modified content:
 */
package com.aicomsoft.log;

import org.apache.log4j.Logger;

public class LogManager
{
    private static Logger logger = Logger.getLogger(LogManager.class.getName());


    /*
     * 记录基本日志信息
     */
    public static void record(LogType logType, String msg)
    {
        if (logType.equals(LogType.ERROR))
        {
            logger.error(msg);
        }
        else if (logType.equals(LogType.WARNING))
        {
            logger.warn(msg);
        }
        else if (logType.equals(LogType.INFO))
        {
            logger.info(msg);
        }
        else if (logType.equals(LogType.DEBUG))
        {
            logger.debug(msg);
        }
    }


    /*
     * 记录异常信息
     */
    public static void record(LogType logType, String msg, Exception e)
    {
        if (logType.equals(LogType.ERROR))
        {
            logger.error(msg, e);
        }
        else if (logType.equals(LogType.WARNING))
        {
            logger.warn(msg, e);
        }
        else if (logType.equals(LogType.INFO))
        {
            logger.info(msg, e);
        }
        else if (logType.equals(LogType.DEBUG))
        {
            logger.debug(msg, e);
        }
    }
}
